var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0}), (o.LoadImgs = void 0);
var n = t("Files");
(function (t) {
    t.sps = {};
    var e = new Array(),
        o = {},
        r = !1;
    function a() {
        if (e.length) {
            r = !0;
            var i = e[0],
                s = o[i];
            n.Files.loadImg(i, s.cache, function (n) {
                if (n) {
                    var r = new cc.SpriteFrame(n);
                    t.sps[i] = r;
                    for (var c = 0, l = s.onCompletes; c < l.length; c++) {
                        var u = l[c];
                        u && u(r);
                    }
                }
                (s.onCompletes.length = 0), delete o[i], e.shift(), a();
            });
        } else r = !1;
    }
    t.load = function (n, i, s) {
        n
            ? t.sps[n]
                ? s && s(t.sps[n])
                : (-1 == e.indexOf(n) && e.push(n),
                  o[n] || (o[n] = {cache: !1, onCompletes: new Array()}),
                  o[n].onCompletes.push(s),
                  r || a())
            : console.error("url=" + n);
    };
})(o.LoadImgs || (o.LoadImgs = {}));
